home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / bin / screen-profiles-status < prev    next >
Encoding:
Text File  |  2009-06-02  |  1.8 KB  |  56 lines

  1. #!/bin/sh -e
  2. #
  3. #    screen-profiles-status
  4. #    Copyright (C) 2008 Canonical Ltd.
  5. #
  6. #    Authors: Dustin Kirkland <kirkland@canonical.com>
  7. #
  8. #    This program is free software: you can redistribute it and/or modify
  9. #    it under the terms of the GNU General Public License as published by
  10. #    the Free Software Foundation, version 3 of the License.
  11. #
  12. #    This program is distributed in the hope that it will be useful,
  13. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. #    GNU General Public License for more details.
  16. #
  17. #    You should have received a copy of the GNU General Public License
  18. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.  
  20. ###########################################################
  21. # We should be really "nice" about gathering status:
  22. #renice 10 $$ >/dev/null 2>&1 || true
  23. #ionice -c3 -p $$ >/dev/null 2>&1 || true
  24. # However, this *really* slows down startup.
  25. # We need a good way of only doing this for updates,
  26. # but not at screen startup.
  27. ###########################################################
  28.  
  29. if [ -d "$HOME/.screen-profiles/bin" ]; then
  30.     DIR="$HOME/.screen-profiles/bin"
  31. elif [ -d "/var/lib/screen-profiles" ]; then
  32.     DIR="/var/lib/screen-profiles"
  33. else
  34.     exit 1
  35. fi
  36.  
  37. P="$1"
  38.  
  39. case "$P" in
  40.     # default = on, user must override to turn off
  41.     cpu-count|cpu-freq|load-average|logo|mem-available|mem-used|menu|reboot-required|release|updates-available)
  42.         grep -qs "^$P=0$" "$HOME/.screen-profiles/status" && exit 0
  43.     ;;
  44.     # default = off, user must override to turn on
  45.     arch|battery|ec2-cost|hostname|network-down|network-up|processes|uptime|users|whoami|wifi-quality)
  46.         grep -qs "^$P=1$" "$HOME/.screen-profiles/status" || exit 0
  47.     ;;
  48.     *)
  49.         exit 1
  50.     ;;
  51. esac
  52.  
  53. if [ -f "$DIR"/"$P" -a -x "$DIR"/"$P" ]; then
  54.     exec "$DIR"/"$P"
  55. fi
  56.